//--------------------------------------------------- // Purpose: Initialize and print an integer array // Author: John Gauch //--------------------------------------------------- #include #include using namespace std; int main() { // Declare array of integers const int DATA_SIZE = 25; int data[DATA_SIZE]; // Initialize array for (int index = 0; index < DATA_SIZE; index++) data[index] = random() % 100; // Print array for (int index = 0; index < DATA_SIZE; index++) cout << data[index] << " "; cout << endl; // Find max value int max = data[0]; for (int index = 0; index < DATA_SIZE; index++) { if (data[index] > max) max = data[index]; } cout << "max = " << max << endl; // Find min value int min = data[0]; for (int index = 0; index < DATA_SIZE; index++) { if (data[index] < min) min = data[index]; } cout << "min = " << min << endl; return 0 ; }